package com.yl.chainStore.control.system

import com.yl.chainStore.control.BaseCtrl
import com.yl.chainStore.entity.system.TableOtherColumn
import com.yl.chainStore.pojo.vo.system.QueryHtmlConfigVo
import com.yl.chainStore.services.ICompanyHtmlConfigService
import com.yl.common.control.ResponseBody
import com.yl.common.control.returnSuccess
import org.springframework.transaction.annotation.Transactional
import org.springframework.web.bind.annotation.*


@RestController
@RequestMapping("system/config")
open class CompanyHtmlConfigController(
    private val companyHtmlConfigService: ICompanyHtmlConfigService
) : BaseCtrl() {

    @PostMapping("addColumn")
    @Transactional
    open fun addColumn(@RequestBody column: TableOtherColumn): ResponseBody {

        return companyHtmlConfigService.add(column)
    }

    @PostMapping("delColumn/{id}")
    @Transactional
    open fun delColumn(@PathVariable id: Long): ResponseBody {
        companyHtmlConfigService.del(id)
        return returnSuccess()
    }

    @PostMapping("getConfig")
    @Transactional
    open fun getConfig(@RequestBody body: QueryHtmlConfigVo): ResponseBody {
        return returnSuccess(companyHtmlConfigService.getConfig(body))
    }


}
